<template>
  <div>
    <van-nav-bar :title="activetitle" fixed />

    <div class="main">
      <keep-alive>
        <router-view></router-view>
      </keep-alive>
    </div>

    <van-tabbar route>
      <van-tabbar-item icon="home-o" repalce to="/layout/home"
        >首页</van-tabbar-item
      >
      <van-tabbar-item icon="search" repalce to="/layout/search"
        >搜索</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      activetitle: this.$route.meta.title, //拿到当前路由所在信息的meta属性
    };
  },
  watch: {
    $route() {
      this.activetitle = this.$route.meta.title;
    },
  },
};
</script>

<style scoped>
.main {
  padding-top: 46px;
  padding-bottom: 50px;
}
</style>